//
//  VKJiFenShopCell.m
//  V-Learn
//
//  Created by liubo on 2019/1/8.
//  Copyright © 2019 yxk. All rights reserved.
//

#import "VKJiFenShopCell.h"

@implementation VKJiFenShopCell{
    UIImageView *_imageView;
    UILabel *_titleLabel;
    UILabel *_countLabel;
}
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setupLayout];
    }
    return self;
}
-(void)setModel:(VKJiFenShopModel *)model{
    _model = model;
    [_imageView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",Public_URL,model.goodsImage]] completed:nil];
    _countLabel.text = [NSString stringWithFormat:@"积分 %@",model.goodsIntegral];
    _titleLabel.text = model.goodsName;
}
- (void)setupLayout{
    
    UIImageView *imageView = [[UIImageView alloc]init];
    [self.contentView addSubview:imageView];
    _imageView = imageView;
//    imageView.image = [UIImage imageNamed:@"girl"];
    imageView.layer.masksToBounds = YES;
    imageView.layer.cornerRadius = 5;
    imageView.contentMode = UIViewContentModeScaleAspectFill;
    imageView.clipsToBounds = YES;
    [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.equalTo(@0);
        make.height.equalTo(@(([UIScreen cz_screenWidth] - 40) / 2.0));
    }];
    UILabel *titleLabel = [[UILabel alloc]init];
    _titleLabel = titleLabel;
    titleLabel.numberOfLines = 0;
    [self.contentView addSubview:titleLabel];
//    titleLabel.text = @"15元通用课程代金券";
    titleLabel.textColor = [UIColor cz_colorWithRed:60 green:60 blue:60];
    titleLabel.font = [UIFont systemFontOfSize:13];
    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@6);
        make.right.mas_equalTo(@(-6));
        make.top.mas_equalTo(imageView.mas_bottom).offset(10);
    }];
    
    UILabel *countLabel = [[UILabel alloc]init];
    _countLabel = countLabel;
    [self.contentView addSubview:countLabel];
    countLabel.textColor = [UIColor cz_colorWithRed:253 green:79 blue:83];
//    countLabel.text = @"2000积分";
    countLabel.font = [UIFont systemFontOfSize:13];
    [countLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(@6);
        make.top.mas_equalTo(titleLabel.mas_bottom).offset(6);
    }];
    
}

@end
